src/libostree/ostree-repo-file-enumerator.h \
src/libostree/ostree-sysroot.c \
src/libostree/ostree-sysroot.h \
+ src/libostree/ostree-bootconfig-parser.h \
+ src/libostree/ostree-bootconfig-parser.c \
+ src/libostree/ostree-deployment.h \
+ src/libostree/ostree-deployment.c \
$(NULL)
if USE_LIBARCHIVE
libostree_1_la_SOURCES += src/libostree/ostree-libarchive-input-stream.h \
src/ostree/ot-bootloader-syslinux.c \
src/ostree/ot-bootloader-uboot.h \
src/ostree/ot-bootloader-uboot.c \
- src/ostree/ot-config-parser.h \
- src/ostree/ot-config-parser.c \
- src/ostree/ot-deployment.h \
- src/ostree/ot-deployment.c \
src/ostree/ot-ordered-hash.h \
src/ostree/ot-ordered-hash.c \
$(NULL)
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "ostree-bootconfig-parser.h"
+#include "libgsystem.h"
+
+struct _OstreeBootconfigParser
+{
+ GObject parent_instance;
+
+ gboolean parsed;
+ char *separators;
+
+ GHashTable *options;
+ GPtrArray *lines;
+};
+
+typedef GObjectClass OstreeBootconfigParserClass;
+
+G_DEFINE_TYPE (OstreeBootconfigParser, ostree_bootconfig_parser, G_TYPE_OBJECT)
+
+gboolean
+ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
+ GFile *path,
+ GCancellable *cancellable,
+ GError **error)
+{
+ gboolean ret = FALSE;
+ gs_free char *contents = NULL;
+ char **lines = NULL;
+ char **iter = NULL;
+
+ g_return_val_if_fail (!self->parsed, FALSE);
+
+ contents = gs_file_load_contents_utf8 (path, cancellable, error);
+ if (!contents)
+ goto out;
+
+ lines = g_strsplit (contents, "\n", -1);
+ for (iter = lines; *iter; iter++)
+ {
+ const char *line = *iter;
+ char *keyname = "";
+
+ if (g_ascii_isalpha (*line))
+ {
+ char **items = NULL;
+ items = g_strsplit_set (line, self->separators, 2);
+ if (g_strv_length (items) == 2 && items[0][0] != '\0')
+ {
+ keyname = items[0];
+ g_hash_table_insert (self->options, items[0], items[1]);
+ g_free (items); /* Transfer ownership */
+ }
+ else
+ {
+ g_strfreev (items);
+ }
+ }
+ g_ptr_array_add (self->lines, g_variant_new ("(ss)", keyname, line));
+ }
+
+ self->parsed = TRUE;
+
+ ret = TRUE;
+ out:
+ g_strfreev (lines);
+ return ret;
+}
+
+void
+ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
+ const char *key,
+ const char *value)
+{
+ g_hash_table_replace (self->options, g_strdup (key), g_strdup (value));
+}
+
+const char *
+ostree_bootconfig_parser_get (OstreeBootconfigParser *self,
+ const char *key)
+{
+ return g_hash_table_lookup (self->options, key);
+}
+
+static gboolean
+write_key (OstreeBootconfigParser *self,
+ GDataOutputStream *out,
+ const char *key,
+ const char *value,
+ GCancellable *cancellable,
+ GError **error)
+{
+ gboolean ret = FALSE;
+
+ if (!g_data_output_stream_put_string (out, key, cancellable, error))
+ goto out;
+ if (!g_data_output_stream_put_byte (out, self->separators[0], cancellable, error))
+ goto out;
+ if (!g_data_output_stream_put_string (out, value, cancellable, error))
+ goto out;
+ if (!g_data_output_stream_put_byte (out, '\n', cancellable, error))
+ goto out;
+
+ ret = TRUE;
+ out:
+ return ret;
+}
+
+gboolean
+ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
+ GFile *output,
+ GCancellable *cancellable,
+ GError **error)
+{
+ gboolean ret = FALSE;
+ GHashTableIter hashiter;
+ gpointer hashkey, hashvalue;
+ gs_unref_object GOutputStream *out = NULL;
+ gs_unref_object GDataOutputStream *dataout = NULL;
+ guint i;
+ gs_unref_hashtable GHashTable *written_overrides = NULL;
+
+ written_overrides = g_hash_table_new (g_str_hash, g_str_equal);
+
+ out = (GOutputStream*)g_file_replace (output, NULL, FALSE, 0, cancellable, error);
+ if (!out)
+ goto out;
+
+ dataout = g_data_output_stream_new (out);
+
+ for (i = 0; i < self->lines->len; i++)
+ {
+ GVariant *linedata = self->lines->pdata[i];
+ const char *key;
+ const char *value;
+ const char *line;
+
+ g_variant_get (linedata, "(&s&s)", &key, &line);
+
+ value = g_hash_table_lookup (self->options, key);
+ if (value == NULL)
+ {
+ if (!g_data_output_stream_put_string (dataout, line, cancellable, error))
+ goto out;
+ if (!g_data_output_stream_put_byte (dataout, '\n', cancellable, error))
+ goto out;
+ }
+ else
+ {
+ if (!write_key (self, dataout, key, value, cancellable, error))
+ goto out;
+ g_hash_table_insert (written_overrides, (gpointer)key, (gpointer)key);
+ }
+ }
+
+ g_hash_table_iter_init (&hashiter, self->options);
+ while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
+ {
+ if (g_hash_table_lookup (written_overrides, hashkey))
+ continue;
+ if (!write_key (self, dataout, hashkey, hashvalue, cancellable, error))
+ goto out;
+ }
+
+ if (!g_output_stream_close ((GOutputStream*)dataout, cancellable, error))
+ goto out;
+
+ ret = TRUE;
+ out:
+ return ret;
+}
+
+static void
+ostree_bootconfig_parser_finalize (GObject *object)
+{
+ OstreeBootconfigParser *self = OSTREE_BOOTCONFIG_PARSER (object);
+
+ g_hash_table_unref (self->options);
+ g_ptr_array_unref (self->lines);
+ g_free (self->separators);
+
+ G_OBJECT_CLASS (ostree_bootconfig_parser_parent_class)->finalize (object);
+}
+
+static void
+ostree_bootconfig_parser_init (OstreeBootconfigParser *self)
+{
+ self->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+ self->lines = g_ptr_array_new ();
+}
+
+void
+ostree_bootconfig_parser_class_init (OstreeBootconfigParserClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ object_class->finalize = ostree_bootconfig_parser_finalize;
+}
+
+OstreeBootconfigParser *
+ostree_bootconfig_parser_new (void)
+{
+ OstreeBootconfigParser *self = NULL;
+
+ self = g_object_new (OSTREE_TYPE_BOOTCONFIG_PARSER, NULL);
+ self->separators = g_strdup (" \t");
+ return self;
+}
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include <gio/gio.h>
+
+G_BEGIN_DECLS
+
+#define OSTREE_TYPE_BOOTCONFIG_PARSER (ostree_bootconfig_parser_get_type ())
+#define OSTREE_BOOTCONFIG_PARSER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_BOOTCONFIG_PARSER, OstreeBootconfigParser))
+#define OSTREE_IS_BOOTCONFIG_PARSER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_BOOTCONFIG_PARSER))
+
+typedef struct _OstreeBootconfigParser OstreeBootconfigParser;
+
+GType ostree_bootconfig_parser_get_type (void) G_GNUC_CONST;
+
+OstreeBootconfigParser * ostree_bootconfig_parser_new (void);
+
+gboolean ostree_bootconfig_parser_parse (OstreeBootconfigParser *self,
+ GFile *path,
+ GCancellable *cancellable,
+ GError **error);
+
+gboolean ostree_bootconfig_parser_write (OstreeBootconfigParser *self,
+ GFile *output,
+ GCancellable *cancellable,
+ GError **error);
+
+void ostree_bootconfig_parser_set (OstreeBootconfigParser *self,
+ const char *key,
+ const char *value);
+
+const char *ostree_bootconfig_parser_get (OstreeBootconfigParser *self,
+ const char *key);
+
+
+G_END_DECLS
+
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include "ostree-deployment.h"
+#include "libgsystem.h"
+
+struct _OstreeDeployment
+{
+ GObject parent_instance;
+
+ int index; /* Global offset */
+ char *osname; /* osname */
+ char *csum; /* OSTree checksum of tree */
+ int deployserial; /* How many times this particular csum appears in deployment list */
+ char *bootcsum; /* Checksum of kernel+initramfs */
+ int bootserial; /* An integer assigned to this tree per its ${bootcsum} */
+ OstreeBootconfigParser *bootconfig; /* Bootloader configuration */
+ GKeyFile *origin; /* How to construct an upgraded version of this tree */
+};
+
+typedef GObjectClass OstreeDeploymentClass;
+
+G_DEFINE_TYPE (OstreeDeployment, ostree_deployment, G_TYPE_OBJECT)
+
+const char *
+ostree_deployment_get_csum (OstreeDeployment *self)
+{
+ return self->csum;
+}
+
+const char *
+ostree_deployment_get_bootcsum (OstreeDeployment *self)
+{
+ return self->bootcsum;
+}
+
+const char *
+ostree_deployment_get_osname (OstreeDeployment *self)
+{
+ return self->osname;
+}
+
+int
+ostree_deployment_get_deployserial (OstreeDeployment *self)
+{
+ return self->deployserial;
+}
+
+int
+ostree_deployment_get_bootserial (OstreeDeployment *self)
+{
+ return self->bootserial;
+}
+
+OstreeBootconfigParser *
+ostree_deployment_get_bootconfig (OstreeDeployment *self)
+{
+ return self->bootconfig;
+}
+
+GKeyFile *
+ostree_deployment_get_origin (OstreeDeployment *self)
+{
+ return self->origin;
+}
+
+int
+ostree_deployment_get_index (OstreeDeployment *self)
+{
+ return self->index;
+}
+
+void
+ostree_deployment_set_index (OstreeDeployment *self, int index)
+{
+ self->index = index;
+}
+
+void
+ostree_deployment_set_bootserial (OstreeDeployment *self, int index)
+{
+ self->bootserial = index;
+}
+
+void
+ostree_deployment_set_bootconfig (OstreeDeployment *self, OstreeBootconfigParser *bootconfig)
+{
+ g_clear_object (&self->bootconfig);
+ if (bootconfig)
+ self->bootconfig = g_object_ref (bootconfig);
+}
+
+void
+ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin)
+{
+ g_clear_pointer (&self->origin, g_key_file_unref);
+ if (origin)
+ self->origin = g_key_file_ref (origin);
+}
+
+OstreeDeployment *
+ostree_deployment_clone (OstreeDeployment *self)
+{
+ OstreeDeployment *ret = ostree_deployment_new (self->index, self->osname, self->csum,
+ self->deployserial,
+ self->bootcsum, self->bootserial);
+ ostree_deployment_set_bootconfig (ret, self->bootconfig);
+ ostree_deployment_set_origin (ret, self->origin);
+ return ret;
+}
+
+guint
+ostree_deployment_hash (gconstpointer v)
+{
+ OstreeDeployment *d = (OstreeDeployment*)v;
+ return g_str_hash (ostree_deployment_get_osname (d)) +
+ g_str_hash (ostree_deployment_get_csum (d)) +
+ ostree_deployment_get_deployserial (d);
+}
+
+gboolean
+ostree_deployment_equal (gconstpointer ap, gconstpointer bp)
+{
+ OstreeDeployment *a = (OstreeDeployment*)ap;
+ OstreeDeployment *b = (OstreeDeployment*)bp;
+
+ if (a == NULL && b == NULL)
+ return TRUE;
+ else if (a != NULL && b != NULL)
+ return g_str_equal (ostree_deployment_get_osname (a),
+ ostree_deployment_get_osname (b)) &&
+ g_str_equal (ostree_deployment_get_csum (a),
+ ostree_deployment_get_csum (b)) &&
+ ostree_deployment_get_deployserial (a) == ostree_deployment_get_deployserial (b);
+ else
+ return FALSE;
+}
+
+static void
+ostree_deployment_finalize (GObject *object)
+{
+ OstreeDeployment *self = OSTREE_DEPLOYMENT (object);
+
+ g_free (self->osname);
+ g_free (self->csum);
+ g_free (self->bootcsum);
+ g_clear_object (&self->bootconfig);
+ g_clear_pointer (&self->origin, g_key_file_unref);
+
+ G_OBJECT_CLASS (ostree_deployment_parent_class)->finalize (object);
+}
+
+void
+ostree_deployment_init (OstreeDeployment *self)
+{
+}
+
+void
+ostree_deployment_class_init (OstreeDeploymentClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ object_class->finalize = ostree_deployment_finalize;
+}
+
+OstreeDeployment *
+ostree_deployment_new (int index,
+ const char *osname,
+ const char *csum,
+ int deployserial,
+ const char *bootcsum,
+ int bootserial)
+{
+ OstreeDeployment *self;
+
+ /* index may be -1 */
+ g_return_val_if_fail (osname != NULL, NULL);
+ g_return_val_if_fail (csum != NULL, NULL);
+ g_return_val_if_fail (deployserial >= 0, NULL);
+ /* We can have "disconnected" deployments that don't have a
+ bootcsum/serial */
+
+ self = g_object_new (OSTREE_TYPE_DEPLOYMENT, NULL);
+ self->index = index;
+ self->osname = g_strdup (osname);
+ self->csum = g_strdup (csum);
+ self->deployserial = deployserial;
+ self->bootcsum = g_strdup (bootcsum);
+ self->bootserial = bootserial;
+ return self;
+}
--- /dev/null
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
+ *
+ * Copyright (C) 2013 Colin Walters <walters@verbum.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2 of the licence or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#pragma once
+
+#include "ostree-bootconfig-parser.h"
+
+G_BEGIN_DECLS
+
+#define OSTREE_TYPE_DEPLOYMENT (ostree_deployment_get_type ())
+#define OSTREE_DEPLOYMENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OSTREE_TYPE_DEPLOYMENT, OstreeDeployment))
+#define OSTREE_IS_DEPLOYMENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OSTREE_TYPE_DEPLOYMENT))
+
+typedef struct _OstreeDeployment OstreeDeployment;
+
+GType ostree_deployment_get_type (void) G_GNUC_CONST;
+
+guint ostree_deployment_hash (gconstpointer v);
+gboolean ostree_deployment_equal (gconstpointer a, gconstpointer b);
+
+OstreeDeployment * ostree_deployment_new (int index,
+ const char *osname,
+ const char *csum,
+ int deployserial,
+ const char *bootcsum,
+ int bootserial);
+
+int ostree_deployment_get_index (OstreeDeployment *self);
+const char *ostree_deployment_get_osname (OstreeDeployment *self);
+int ostree_deployment_get_deployserial (OstreeDeployment *self);
+const char *ostree_deployment_get_csum (OstreeDeployment *self);
+const char *ostree_deployment_get_bootcsum (OstreeDeployment *self);
+int ostree_deployment_get_bootserial (OstreeDeployment *self);
+OstreeBootconfigParser *ostree_deployment_get_bootconfig (OstreeDeployment *self);
+GKeyFile *ostree_deployment_get_origin (OstreeDeployment *self);
+
+void ostree_deployment_set_index (OstreeDeployment *self, int index);
+void ostree_deployment_set_bootserial (OstreeDeployment *self, int index);
+void ostree_deployment_set_bootconfig (OstreeDeployment *self, OstreeBootconfigParser *bootconfig);
+void ostree_deployment_set_origin (OstreeDeployment *self, GKeyFile *origin);
+
+OstreeDeployment *ostree_deployment_clone (OstreeDeployment *self);
+
+
+G_END_DECLS
+
#include <ostree-mutable-tree.h>
#include <ostree-repo-file.h>
#include <ostree-sysroot.h>
+#include <ostree-deployment.h>
+#include <ostree-bootconfig-parser.h>
#include <ostree-diff.h>
gs_unref_object OstreeRepo *repo = NULL;
gs_unref_ptrarray GPtrArray *current_deployments = NULL;
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
- gs_unref_object OtDeployment *new_deployment = NULL;
- gs_unref_object OtDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *new_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
gs_free char *revision = NULL;
context = g_option_context_new ("REFSPEC - Checkout revision REFSPEC as the new default deployment");
GOptionContext *context;
gboolean ret = FALSE;
gs_unref_object GFile *repo_path = NULL;
- gs_unref_object OtDeployment *deployment = NULL;
+ gs_unref_object OstreeDeployment *deployment = NULL;
gs_unref_object GFile *deployment_dir = NULL;
gs_unref_ptrarray GPtrArray *modified = NULL;
gs_unref_ptrarray GPtrArray *removed = NULL;
cancellable, error))
goto out;
if (deployment != NULL)
- opt_osname = (char*)ot_deployment_get_osname (deployment);
+ opt_osname = (char*)ostree_deployment_get_osname (deployment);
if (deployment == NULL)
deployment = ot_admin_get_merge_deployment (deployments, opt_osname, deployment);
if (deployment == NULL)
GOptionContext *context;
gboolean ret = FALSE;
int bootversion;
- gs_unref_object OtDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
gs_unref_ptrarray GPtrArray *deployments = NULL;
guint i;
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
GKeyFile *origin;
g_print ("%c %s %s.%d\n",
deployment == booted_deployment ? '*' : ' ',
- ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
- origin = ot_deployment_get_origin (deployment);
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
+ origin = ostree_deployment_get_origin (deployment);
if (!origin)
g_print (" origin: none\n");
else
int deploy_index;
int current_bootversion;
gs_unref_ptrarray GPtrArray *current_deployments = NULL;
- gs_unref_object OtDeployment *booted_deployment = NULL;
- gs_unref_object OtDeployment *target_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *target_deployment = NULL;
context = g_option_context_new ("INDEX - Delete deployment INDEX");
cancellable, error))
goto out;
- g_print ("Deleted deployment %s.%d\n", ot_deployment_get_csum (target_deployment),
- ot_deployment_get_deployserial (target_deployment));
+ g_print ("Deleted deployment %s.%d\n", ostree_deployment_get_csum (target_deployment),
+ ostree_deployment_get_deployserial (target_deployment));
if (!ot_admin_cleanup (ostree_sysroot_get_path (sysroot), cancellable, error))
{
gs_free char *new_revision = NULL;
gs_unref_object GFile *deployment_path = NULL;
gs_unref_object GFile *deployment_origin_path = NULL;
- gs_unref_object OtDeployment *booted_deployment = NULL;
- gs_unref_object OtDeployment *merge_deployment = NULL;
+ gs_unref_object OstreeDeployment *booted_deployment = NULL;
+ gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_ptrarray GPtrArray *current_deployments = NULL;
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
- gs_unref_object OtDeployment *new_deployment = NULL;
+ gs_unref_object OstreeDeployment *new_deployment = NULL;
int current_bootversion;
int new_bootversion;
GKeyFile *origin;
cancellable, error))
goto out;
if (!opt_osname)
- opt_osname = (char*)ot_deployment_get_osname (booted_deployment);
+ opt_osname = (char*)ostree_deployment_get_osname (booted_deployment);
merge_deployment = ot_admin_get_merge_deployment (current_deployments, opt_osname,
booted_deployment);
if (!ostree_repo_open (repo, cancellable, error))
goto out;
- origin = ot_deployment_get_origin (merge_deployment);
+ origin = ostree_deployment_get_origin (merge_deployment);
if (!origin)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
error))
goto out;
- if (strcmp (ot_deployment_get_csum (merge_deployment), new_revision) == 0)
+ if (strcmp (ostree_deployment_get_csum (merge_deployment), new_revision) == 0)
{
g_print ("Refspec %s is unchanged\n", origin_refspec);
}
#include "config.h"
#include "ot-admin-functions.h"
-#include "ot-deployment.h"
-#include "ot-config-parser.h"
#include "otutil.h"
#include "ostree.h"
#include "libgsystem.h"
const char *name;
GFileInfo *file_info = NULL;
GFile *child = NULL;
- gs_unref_object OtDeployment *deployment = NULL;
+ gs_unref_object OstreeDeployment *deployment = NULL;
gs_free char *csum = NULL;
gint deployserial;
if (!ot_admin_parse_deploy_path_name (name, &csum, &deployserial, error))
goto out;
- deployment = ot_deployment_new (-1, osname, csum, deployserial, NULL, -1);
+ deployment = ostree_deployment_new (-1, osname, csum, deployserial, NULL, -1);
g_ptr_array_add (inout_deployments, g_object_ref (deployment));
}
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
GFile *deployment_path = ot_admin_get_deployment_directory (sysroot, deployment);
- char *bootcsum = g_strdup (ot_deployment_get_bootcsum (deployment));
+ char *bootcsum = g_strdup (ostree_deployment_get_bootcsum (deployment));
/* Transfer ownership */
g_hash_table_insert (active_deployment_dirs, deployment_path, deployment_path);
g_hash_table_insert (active_boot_checksums, bootcsum, bootcsum);
for (i = 0; i < all_deployment_dirs->len; i++)
{
- OtDeployment *deployment = all_deployment_dirs->pdata[i];
+ OstreeDeployment *deployment = all_deployment_dirs->pdata[i];
gs_unref_object GFile *deployment_path = ot_admin_get_deployment_directory (sysroot, deployment);
gs_unref_object GFile *origin_path = ot_admin_get_deployment_origin_path (deployment_path);
if (!g_hash_table_lookup (active_deployment_dirs, deployment_path))
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
gs_free char *refname = g_strdup_printf ("ostree/%d/%d/%u",
bootversion, subbootversion,
i);
if (!ostree_repo_prepare_transaction (repo, NULL, cancellable, error))
goto out;
- ostree_repo_transaction_set_refspec (repo, refname, ot_deployment_get_csum (deployment));
+ ostree_repo_transaction_set_refspec (repo, refname, ostree_deployment_get_csum (deployment));
if (!ostree_repo_commit_transaction (repo, NULL, cancellable, error))
goto out;
#include "ot-admin-functions.h"
#include "ot-admin-deploy.h"
-#include "ot-deployment.h"
-#include "ot-config-parser.h"
#include "ot-bootloader-syslinux.h"
#include "otutil.h"
#include "ostree-core.h"
static gboolean
checkout_deployment_tree (GFile *sysroot,
OstreeRepo *repo,
- OtDeployment *deployment,
+ OstreeDeployment *deployment,
GFile **out_deployment_path,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- const char *csum = ot_deployment_get_csum (deployment);
+ const char *csum = ostree_deployment_get_csum (deployment);
gs_unref_object GFile *root = NULL;
gs_unref_object GFileInfo *file_info = NULL;
gs_free char *checkout_target_name = NULL;
goto out;
osdeploy_path = ot_gfile_get_child_build_path (sysroot, "ostree", "deploy",
- ot_deployment_get_osname (deployment),
+ ostree_deployment_get_osname (deployment),
"deploy", NULL);
- checkout_target_name = g_strdup_printf ("%s.%d", csum, ot_deployment_get_deployserial (deployment));
+ checkout_target_name = g_strdup_printf ("%s.%d", csum, ostree_deployment_get_deployserial (deployment));
deploy_target_path = g_file_get_child (osdeploy_path, checkout_target_name);
deploy_parent = g_file_get_parent (deploy_target_path);
static gboolean
merge_configuration (GFile *sysroot,
- OtDeployment *previous_deployment,
- OtDeployment *deployment,
+ OstreeDeployment *previous_deployment,
+ OstreeDeployment *deployment,
GFile *deployment_path,
GCancellable *cancellable,
GError **error)
if (previous_deployment)
{
gs_unref_object GFile *previous_path = NULL;
- OtConfigParser *previous_bootconfig;
+ OstreeBootconfigParser *previous_bootconfig;
previous_path = ot_admin_get_deployment_directory (sysroot, previous_deployment);
source_etc_path = g_file_resolve_relative_path (previous_path, "etc");
source_etc_pristine_path = g_file_resolve_relative_path (previous_path, "usr/etc");
- previous_bootconfig = ot_deployment_get_bootconfig (previous_deployment);
+ previous_bootconfig = ostree_deployment_get_bootconfig (previous_deployment);
if (previous_bootconfig)
{
- const char *previous_options = ot_config_parser_get (previous_bootconfig, "options");
+ const char *previous_options = ostree_bootconfig_parser_get (previous_bootconfig, "options");
/* Completely overwrite the previous options here; we will extend
* them later.
*/
- ot_config_parser_set (ot_deployment_get_bootconfig (deployment), "options",
+ ostree_bootconfig_parser_set (ostree_deployment_get_bootconfig (deployment), "options",
previous_options);
}
}
static gboolean
write_origin_file (GFile *sysroot,
- OtDeployment *deployment,
+ OstreeDeployment *deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- GKeyFile *origin = ot_deployment_get_origin (deployment);
+ GKeyFile *origin = ostree_deployment_get_origin (deployment);
if (origin)
{
static int
sort_by_bootserial (gconstpointer ap, gconstpointer bp)
{
- OtDeployment **a_loc = (OtDeployment**)ap;
- OtDeployment *a = *a_loc;
- OtDeployment **b_loc = (OtDeployment**)bp;
- OtDeployment *b = *b_loc;
+ OstreeDeployment **a_loc = (OstreeDeployment**)ap;
+ OstreeDeployment *a = *a_loc;
+ OstreeDeployment **b_loc = (OstreeDeployment**)bp;
+ OstreeDeployment *b = *b_loc;
- if (ot_deployment_get_bootserial (a) == ot_deployment_get_bootserial (b))
+ if (ostree_deployment_get_bootserial (a) == ostree_deployment_get_bootserial (b))
return 0;
- else if (ot_deployment_get_bootserial (a) < ot_deployment_get_bootserial (b))
+ else if (ostree_deployment_get_bootserial (a) < ostree_deployment_get_bootserial (b))
return -1;
return 1;
}
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
- if (strcmp (ot_deployment_get_bootcsum (deployment), bootcsum) != 0)
+ if (strcmp (ostree_deployment_get_bootcsum (deployment), bootcsum) != 0)
continue;
g_ptr_array_add (ret, deployment);
compute_new_deployment_list (int current_bootversion,
GPtrArray *current_deployments,
const char *osname,
- OtDeployment *booted_deployment,
- OtDeployment *merge_deployment,
+ OstreeDeployment *booted_deployment,
+ OstreeDeployment *merge_deployment,
gboolean retain,
const char *revision,
const char *bootcsum,
int new_index;
guint new_deployserial = 0;
int new_bootserial = 0;
- gs_unref_object OtDeployment *new_deployment = NULL;
+ gs_unref_object OstreeDeployment *new_deployment = NULL;
gs_unref_ptrarray GPtrArray *matching_deployments_by_bootserial = NULL;
- OtDeployment *deployment_to_delete = NULL;
+ OstreeDeployment *deployment_to_delete = NULL;
gs_unref_ptrarray GPtrArray *ret_new_deployments = NULL;
gboolean requires_new_bootversion;
if (osname == NULL)
- osname = ot_deployment_get_osname (booted_deployment);
+ osname = ostree_deployment_get_osname (booted_deployment);
/* First, compute the serial for this deployment; we look
* for other ones in this os with the same checksum.
*/
for (i = 0; i < current_deployments->len; i++)
{
- OtDeployment *deployment = current_deployments->pdata[i];
+ OstreeDeployment *deployment = current_deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
- if (strcmp (ot_deployment_get_csum (deployment), revision) != 0)
+ if (strcmp (ostree_deployment_get_csum (deployment), revision) != 0)
continue;
- new_deployserial = MAX(new_deployserial, ot_deployment_get_deployserial (deployment)+1);
+ new_deployserial = MAX(new_deployserial, ostree_deployment_get_deployserial (deployment)+1);
}
/* We retain by default (well, hardcoded now) one previous
{
for (i = 0; i < current_deployments->len; i++)
{
- OtDeployment *deployment = current_deployments->pdata[i];
+ OstreeDeployment *deployment = current_deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
// Keep both the booted and merge deployments
- if (ot_deployment_equal (deployment, booted_deployment) ||
- ot_deployment_equal (deployment, merge_deployment))
+ if (ostree_deployment_equal (deployment, booted_deployment) ||
+ ostree_deployment_equal (deployment, merge_deployment))
continue;
deployment_to_delete = deployment;
*/
requires_new_bootversion =
(deployment_to_delete == NULL) ||
- (strcmp (ot_deployment_get_bootcsum (deployment_to_delete), bootcsum) != 0);
+ (strcmp (ostree_deployment_get_bootcsum (deployment_to_delete), bootcsum) != 0);
ret_new_deployments = g_ptr_array_new_with_free_func ((GDestroyNotify)g_object_unref);
- new_deployment = ot_deployment_new (0, osname, revision, new_deployserial,
+ new_deployment = ostree_deployment_new (0, osname, revision, new_deployserial,
bootcsum, new_bootserial);
g_ptr_array_add (ret_new_deployments, g_object_ref (new_deployment));
new_index = 1;
for (i = 0; i < current_deployments->len; i++)
{
- OtDeployment *orig_deployment = current_deployments->pdata[i];
- gs_unref_object OtDeployment *deployment_clone = NULL;
+ OstreeDeployment *orig_deployment = current_deployments->pdata[i];
+ gs_unref_object OstreeDeployment *deployment_clone = NULL;
if (orig_deployment == deployment_to_delete)
continue;
- deployment_clone = ot_deployment_clone (orig_deployment);
- ot_deployment_set_index (deployment_clone, new_index);
+ deployment_clone = ostree_deployment_clone (orig_deployment);
+ ostree_deployment_set_index (deployment_clone, new_index);
new_index++;
g_ptr_array_add (ret_new_deployments, g_object_ref (deployment_clone));
}
osname, bootcsum);
for (i = 0; i < matching_deployments_by_bootserial->len; i++)
{
- OtDeployment *deployment = matching_deployments_by_bootserial->pdata[i];
- ot_deployment_set_bootserial (deployment, i);
+ OstreeDeployment *deployment = matching_deployments_by_bootserial->pdata[i];
+ ostree_deployment_set_bootserial (deployment, i);
}
*out_new_deployments = ret_new_deployments;
g_hash_table_iter_init (&hashiter, set);
while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
{
- OtDeployment *deployment = hashkey;
+ OstreeDeployment *deployment = hashkey;
g_print (" %c %s %s.%d",
- for_removal ? '-' : '+', ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
+ for_removal ? '-' : '+', ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
if (!for_removal)
- g_print (" index=%d", ot_deployment_get_index (deployment));
+ g_print (" index=%d", ostree_deployment_get_index (deployment));
g_print ("\n");
}
}
print_deployment_diff (GPtrArray *current_deployments,
GPtrArray *new_deployments)
{
- gs_unref_hashtable GHashTable *curset = object_array_to_set (current_deployments, ot_deployment_hash, ot_deployment_equal);
- gs_unref_hashtable GHashTable *newset = object_array_to_set (new_deployments, ot_deployment_hash, ot_deployment_equal);
+ gs_unref_hashtable GHashTable *curset = object_array_to_set (current_deployments, ostree_deployment_hash, ostree_deployment_equal);
+ gs_unref_hashtable GHashTable *newset = object_array_to_set (new_deployments, ostree_deployment_hash, ostree_deployment_equal);
gs_unref_hashtable GHashTable *removed = NULL;
gs_unref_hashtable GHashTable *added = NULL;
for (i = 0; i < new_deployments->len; i++)
{
- OtDeployment *deployment = new_deployments->pdata[i];
+ OstreeDeployment *deployment = new_deployments->pdata[i];
gs_free char *bootlink_pathname = g_strdup_printf ("%s/%s/%d",
- ot_deployment_get_osname (deployment),
- ot_deployment_get_bootcsum (deployment),
- ot_deployment_get_bootserial (deployment));
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_bootcsum (deployment),
+ ostree_deployment_get_bootserial (deployment));
gs_free char *bootlink_target = g_strdup_printf ("../../../deploy/%s/deploy/%s.%d",
- ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
gs_unref_object GFile *linkname = g_file_get_child (ostree_subbootdir, bootlink_pathname);
gs_unref_object GFile *linkname_parent = g_file_get_parent (linkname);
static gboolean
install_deployment_kernel (GFile *sysroot,
int new_bootversion,
- OtDeployment *deployment,
+ OstreeDeployment *deployment,
guint n_deployments,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- const char *osname = ot_deployment_get_osname (deployment);
- const char *bootcsum = ot_deployment_get_bootcsum (deployment);
+ const char *osname = ostree_deployment_get_osname (deployment);
+ const char *bootcsum = ostree_deployment_get_bootcsum (deployment);
gs_unref_object GFile *bootdir = NULL;
gs_unref_object GFile *bootcsumdir = NULL;
gs_unref_object GFile *bootconfpath = NULL;
gs_free char *options_key = NULL;
__attribute__((cleanup(ot_ordered_hash_cleanup))) OtOrderedHash *ohash = NULL;
const char *val;
- OtConfigParser *bootconfig;
+ OstreeBootconfigParser *bootconfig;
gsize len;
- bootconfig = ot_deployment_get_bootconfig (deployment);
+ bootconfig = ostree_deployment_get_bootconfig (deployment);
deployment_dir = ot_admin_get_deployment_directory (sysroot, deployment);
if (!get_kernel_from_tree (deployment_dir, &tree_kernel_path, &tree_initramfs_path,
bootcsum);
bootconfpath = ot_gfile_resolve_path_printf (bootdir, "loader.%d/entries/ostree-%s-%s-%d.conf",
new_bootversion, osname,
- ot_deployment_get_csum (deployment),
- ot_deployment_get_bootserial (deployment));
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_bootserial (deployment));
if (!gs_file_ensure_directory (bootcsumdir, TRUE, cancellable, error))
goto out;
goto out;
}
- title_key = g_strdup_printf ("ostree:%s:%d %s", ot_deployment_get_osname (deployment),
- ot_deployment_get_index (deployment),
+ title_key = g_strdup_printf ("ostree:%s:%d %s", ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_index (deployment),
val);
- ot_config_parser_set (bootconfig, "title", title_key);
+ ostree_bootconfig_parser_set (bootconfig, "title", title_key);
- version_key = g_strdup_printf ("%d", n_deployments - ot_deployment_get_index (deployment));
- ot_config_parser_set (bootconfig, "version", version_key);
+ version_key = g_strdup_printf ("%d", n_deployments - ostree_deployment_get_index (deployment));
+ ostree_bootconfig_parser_set (bootconfig, "version", version_key);
linux_relpath = g_file_get_relative_path (bootdir, dest_kernel_path);
linux_key = g_strconcat ("/", linux_relpath, NULL);
- ot_config_parser_set (bootconfig, "linux", linux_key);
+ ostree_bootconfig_parser_set (bootconfig, "linux", linux_key);
if (dest_initramfs_path)
{
initramfs_relpath = g_file_get_relative_path (bootdir, dest_initramfs_path);
initrd_key = g_strconcat ("/", initramfs_relpath, NULL);
- ot_config_parser_set (bootconfig, "initrd", initrd_key);
+ ostree_bootconfig_parser_set (bootconfig, "initrd", initrd_key);
}
- val = ot_config_parser_get (bootconfig, "options");
+ val = ostree_bootconfig_parser_get (bootconfig, "options");
ostree_kernel_arg = g_strdup_printf ("/ostree/boot.%d/%s/%s/%d",
new_bootversion, osname, bootcsum,
- ot_deployment_get_bootserial (deployment));
+ ostree_deployment_get_bootserial (deployment));
ohash = ot_admin_parse_kernel_args (val);
ot_ordered_hash_replace_key (ohash, "ostree", ostree_kernel_arg);
options_key = ot_admin_kernel_arg_string_serialize (ohash);
- ot_config_parser_set (bootconfig, "options", options_key);
+ ostree_bootconfig_parser_set (bootconfig, "options", options_key);
- if (!ot_config_parser_write (ot_deployment_get_bootconfig (deployment), bootconfpath,
+ if (!ostree_bootconfig_parser_write (ostree_deployment_get_bootconfig (deployment), bootconfpath,
cancellable, error))
goto out;
{
for (i = 0; i < new_deployments->len; i++)
{
- OtDeployment *deployment = new_deployments->pdata[i];
+ OstreeDeployment *deployment = new_deployments->pdata[i];
if (!install_deployment_kernel (sysroot, new_bootversion,
deployment, new_deployments->len,
cancellable, error))
GKeyFile *origin,
char **add_kernel_argv,
gboolean retain,
- OtDeployment *booted_deployment,
- OtDeployment *provided_merge_deployment,
- OtDeployment **out_new_deployment,
+ OstreeDeployment *booted_deployment,
+ OstreeDeployment *provided_merge_deployment,
+ OstreeDeployment **out_new_deployment,
int *out_new_bootversion,
GPtrArray **out_new_deployments,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- OtDeployment *new_deployment;
- gs_unref_object OtDeployment *merge_deployment = NULL;
+ OstreeDeployment *new_deployment;
+ gs_unref_object OstreeDeployment *merge_deployment = NULL;
gs_unref_object OstreeRepo *repo = NULL;
gs_unref_object GFile *commit_root = NULL;
gs_unref_object GFile *tree_kernel_path = NULL;
gs_unref_object GFile *tree_initramfs_path = NULL;
gs_unref_object GFile *new_deployment_path = NULL;
gs_free char *new_bootcsum = NULL;
- gs_unref_object OtConfigParser *bootconfig = NULL;
+ gs_unref_object OstreeBootconfigParser *bootconfig = NULL;
gs_unref_ptrarray GPtrArray *new_deployments = NULL;
int new_bootversion;
&new_deployments,
&new_bootversion);
new_deployment = g_object_ref (new_deployments->pdata[0]);
- ot_deployment_set_origin (new_deployment, origin);
+ ostree_deployment_set_origin (new_deployment, origin);
print_deployment_diff (current_deployments, new_deployments);
/* Create an empty boot configuration; we will merge things into
* it as we go.
*/
- bootconfig = ot_config_parser_new (" ");
- ot_deployment_set_bootconfig (new_deployment, bootconfig);
+ bootconfig = ostree_bootconfig_parser_new ();
+ ostree_deployment_set_bootconfig (new_deployment, bootconfig);
if (!merge_configuration (sysroot, merge_deployment, new_deployment,
new_deployment_path,
__attribute__((cleanup(ot_ordered_hash_cleanup))) OtOrderedHash *ohash = NULL;
gs_free char *new_options = NULL;
- ohash = ot_admin_parse_kernel_args (ot_config_parser_get (bootconfig, "options"));
+ ohash = ot_admin_parse_kernel_args (ostree_bootconfig_parser_get (bootconfig, "options"));
for (strviter = add_kernel_argv; *strviter; strviter++)
{
}
new_options = ot_admin_kernel_arg_string_serialize (ohash);
- ot_config_parser_set (bootconfig, "options", new_options);
+ ostree_bootconfig_parser_set (bootconfig, "options", new_options);
}
if (!ot_admin_write_deployments (sysroot, current_bootversion, new_bootversion,
* done from the host.
*/
{
- gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (sysroot, "ostree/deploy/%s", ot_deployment_get_osname (new_deployment));
+ gs_unref_object GFile *osdir = ot_gfile_resolve_path_printf (sysroot, "ostree/deploy/%s", ostree_deployment_get_osname (new_deployment));
gs_unref_object GFile *os_current_path = g_file_get_child (osdir, "current");
gs_free char *target = g_file_get_relative_path (osdir, new_deployment_path);
g_assert (target != NULL);
#pragma once
#include <gio/gio.h>
-#include "ot-deployment.h"
+#include <ostree.h>
#include "ot-bootloader.h"
#include "ot-ordered-hash.h"
GKeyFile *origin,
char **add_kernel_argv,
gboolean retain,
- OtDeployment *booted_deployment,
- OtDeployment *merge_deployment,
- OtDeployment **out_new_deployment,
+ OstreeDeployment *booted_deployment,
+ OstreeDeployment *merge_deployment,
+ OstreeDeployment **out_new_deployment,
int *out_new_bootversion,
GPtrArray **out_new_deployments,
GCancellable *cancellable,
#include "config.h"
#include "ot-admin-functions.h"
-#include "ot-deployment.h"
-#include "ot-config-parser.h"
#include "ot-bootloader-syslinux.h"
#include "ot-bootloader-uboot.h"
#include "otutil.h"
static gboolean
parse_deployment (GFile *sysroot,
const char *boot_link,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
const char *relative_boot_link;
- gs_unref_object OtDeployment *ret_deployment = NULL;
+ gs_unref_object OstreeDeployment *ret_deployment = NULL;
int entry_boot_version;
int treebootserial = -1;
int deployserial = -1;
cancellable, error))
goto out;
- ret_deployment = ot_deployment_new (-1, osname, treecsum, deployserial,
+ ret_deployment = ostree_deployment_new (-1, osname, treecsum, deployserial,
bootcsum, treebootserial);
if (origin)
- ot_deployment_set_origin (ret_deployment, origin);
+ ostree_deployment_set_origin (ret_deployment, origin);
ret = TRUE;
ot_transfer_out_value (out_deployment, &ret_deployment);
/**
* ot_admin_find_booted_deployment:
* @target_sysroot: Root directory
- * @deployments: (element-type OtDeployment): Loaded deployments
+ * @deployments: (element-type OstreeDeployment): Loaded deployments
* @out_deployment: (out): The currently booted deployment
* @cancellable:
* @error:
gboolean
ot_admin_find_booted_deployment (GFile *target_sysroot,
GPtrArray *deployments,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gs_unref_object GFile *active_root = g_file_new_for_path ("/");
- gs_unref_object OtDeployment *ret_deployment = NULL;
+ gs_unref_object OstreeDeployment *ret_deployment = NULL;
if (g_file_equal (active_root, target_sysroot))
{
{
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
gs_unref_object GFile *deployment_path = ot_admin_get_deployment_directory (active_root, deployment);
guint32 device;
guint64 inode;
ot_admin_require_deployment_or_osname (GFile *sysroot,
GPtrArray *deployments,
const char *osname,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
- gs_unref_object OtDeployment *ret_deployment = NULL;
+ gs_unref_object OstreeDeployment *ret_deployment = NULL;
if (!ot_admin_find_booted_deployment (sysroot, deployments, &ret_deployment,
cancellable, error))
return ret;
}
-OtDeployment *
+OstreeDeployment *
ot_admin_get_merge_deployment (GPtrArray *deployments,
const char *osname,
- OtDeployment *booted_deployment)
+ OstreeDeployment *booted_deployment)
{
g_return_val_if_fail (osname != NULL || booted_deployment != NULL, NULL);
if (osname == NULL)
- osname = ot_deployment_get_osname (booted_deployment);
+ osname = ostree_deployment_get_osname (booted_deployment);
if (booted_deployment &&
- g_strcmp0 (ot_deployment_get_osname (booted_deployment), osname) == 0)
+ g_strcmp0 (ostree_deployment_get_osname (booted_deployment), osname) == 0)
{
return g_object_ref (booted_deployment);
}
guint i;
for (i = 0; i < deployments->len; i++)
{
- OtDeployment *deployment = deployments->pdata[i];
+ OstreeDeployment *deployment = deployments->pdata[i];
- if (strcmp (ot_deployment_get_osname (deployment), osname) != 0)
+ if (strcmp (ostree_deployment_get_osname (deployment), osname) != 0)
continue;
return g_object_ref (deployment);
g_str_has_suffix (name, ".conf") &&
g_file_info_get_file_type (file_info) == G_FILE_TYPE_REGULAR)
{
- gs_unref_object OtConfigParser *config = ot_config_parser_new (" \t");
+ gs_unref_object OstreeBootconfigParser *config = ostree_bootconfig_parser_new ();
- if (!ot_config_parser_parse (config, child, cancellable, error))
+ if (!ostree_bootconfig_parser_parse (config, child, cancellable, error))
{
g_prefix_error (error, "Parsing %s: ", gs_file_get_path_cached (child));
goto out;
}
static char *
-get_ostree_kernel_arg_from_config (OtConfigParser *config)
+get_ostree_kernel_arg_from_config (OstreeBootconfigParser *config)
{
const char *options;
char *ret = NULL;
char **opts, **iter;
- options = ot_config_parser_get (config, "options");
+ options = ostree_bootconfig_parser_get (config, "options");
if (!options)
return NULL;
static gboolean
list_deployments_process_one_boot_entry (GFile *sysroot,
- OtConfigParser *config,
+ OstreeBootconfigParser *config,
GPtrArray *inout_deployments,
GCancellable *cancellable,
GError **error)
{
gboolean ret = FALSE;
gs_free char *ostree_arg = NULL;
- gs_unref_object OtDeployment *deployment = NULL;
+ gs_unref_object OstreeDeployment *deployment = NULL;
ostree_arg = get_ostree_kernel_arg_from_config (config);
if (ostree_arg == NULL)
cancellable, error))
goto out;
- ot_deployment_set_bootconfig (deployment, config);
+ ostree_deployment_set_bootconfig (deployment, config);
g_ptr_array_add (inout_deployments, g_object_ref (deployment));
compare_deployments_by_boot_loader_version_reversed (gconstpointer a_pp,
gconstpointer b_pp)
{
- OtDeployment *a = *((OtDeployment**)a_pp);
- OtDeployment *b = *((OtDeployment**)b_pp);
- OtConfigParser *a_bootconfig = ot_deployment_get_bootconfig (a);
- OtConfigParser *b_bootconfig = ot_deployment_get_bootconfig (b);
- const char *a_version = ot_config_parser_get (a_bootconfig, "version");
- const char *b_version = ot_config_parser_get (b_bootconfig, "version");
+ OstreeDeployment *a = *((OstreeDeployment**)a_pp);
+ OstreeDeployment *b = *((OstreeDeployment**)b_pp);
+ OstreeBootconfigParser *a_bootconfig = ostree_deployment_get_bootconfig (a);
+ OstreeBootconfigParser *b_bootconfig = ostree_deployment_get_bootconfig (b);
+ const char *a_version = ostree_bootconfig_parser_get (a_bootconfig, "version");
+ const char *b_version = ostree_bootconfig_parser_get (b_bootconfig, "version");
if (a_version && b_version)
{
for (i = 0; i < boot_loader_configs->len; i++)
{
- OtConfigParser *config = boot_loader_configs->pdata[i];
+ OstreeBootconfigParser *config = boot_loader_configs->pdata[i];
if (!list_deployments_process_one_boot_entry (sysroot, config, ret_deployments,
cancellable, error))
g_ptr_array_sort (ret_deployments, compare_deployments_by_boot_loader_version_reversed);
for (i = 0; i < ret_deployments->len; i++)
{
- OtDeployment *deployment = ret_deployments->pdata[i];
- ot_deployment_set_index (deployment, i);
+ OstreeDeployment *deployment = ret_deployments->pdata[i];
+ ostree_deployment_set_index (deployment, i);
}
ret = TRUE;
GFile *
ot_admin_get_deployment_directory (GFile *sysroot,
- OtDeployment *deployment)
+ OstreeDeployment *deployment)
{
gs_free char *path = g_strdup_printf ("ostree/deploy/%s/deploy/%s.%d",
- ot_deployment_get_osname (deployment),
- ot_deployment_get_csum (deployment),
- ot_deployment_get_deployserial (deployment));
+ ostree_deployment_get_osname (deployment),
+ ostree_deployment_get_csum (deployment),
+ ostree_deployment_get_deployserial (deployment));
return g_file_resolve_relative_path (sysroot, path);
}
#pragma once
#include <gio/gio.h>
-#include "ostree.h"
-#include "ot-deployment.h"
+#include <ostree.h>
#include "ot-bootloader.h"
#include "ot-ordered-hash.h"
gboolean ot_admin_find_booted_deployment (GFile *sysroot,
GPtrArray *deployments,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error);
gboolean ot_admin_require_booted_deployment (GFile *sysroot,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error);
gboolean ot_admin_require_deployment_or_osname (GFile *sysroot,
GPtrArray *deployment_list,
const char *osname,
- OtDeployment **out_deployment,
+ OstreeDeployment **out_deployment,
GCancellable *cancellable,
GError **error);
-OtDeployment *ot_admin_get_merge_deployment (GPtrArray *deployment_list,
+OstreeDeployment *ot_admin_get_merge_deployment (GPtrArray *deployment_list,
const char *osname,
- OtDeployment *booted_deployment);
+ OstreeDeployment *booted_deployment);
GFile *ot_admin_get_deployment_origin_path (GFile *deployment_path);
GFile *ot_admin_get_deployment_directory (GFile *sysroot,
- OtDeployment *deployment);
+ OstreeDeployment *deployment);
gboolean ot_admin_get_repo (GFile *sysroot,
OstreeRepo **out_repo,
for (i = 0; i < boot_loader_configs->len; i++)
{
- OtConfigParser *config = boot_loader_configs->pdata[i];
+ OstreeBootconfigParser *config = boot_loader_configs->pdata[i];
const char *val;
- val = ot_config_parser_get (config, "title");
+ val = ostree_bootconfig_parser_get (config, "title");
if (!val)
val = "(Untitled)";
g_ptr_array_add (new_lines, g_strdup_printf ("LABEL %s", val));
- val = ot_config_parser_get (config, "linux");
+ val = ostree_bootconfig_parser_get (config, "linux");
if (!val)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
}
g_ptr_array_add (new_lines, g_strdup_printf ("\tKERNEL %s", val));
- val = ot_config_parser_get (config, "initrd");
+ val = ostree_bootconfig_parser_get (config, "initrd");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("\tINITRD %s", val));
- val = ot_config_parser_get (config, "options");
+ val = ostree_bootconfig_parser_get (config, "options");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("\tAPPEND %s", val));
}
GError **error)
{
gs_unref_ptrarray GPtrArray *boot_loader_configs = NULL;
- OtConfigParser *config;
+ OstreeBootconfigParser *config;
const char *val;
if (!ot_admin_read_boot_loader_configs (self->sysroot, bootversion, &boot_loader_configs,
/* U-Boot doesn't support a menu so just pick the first one since the list is ordered */
config = boot_loader_configs->pdata[0];
- val = ot_config_parser_get (config, "linux");
+ val = ostree_bootconfig_parser_get (config, "linux");
if (!val)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
}
g_ptr_array_add (new_lines, g_strdup_printf ("kernel_image=%s", val));
- val = ot_config_parser_get (config, "initrd");
+ val = ostree_bootconfig_parser_get (config, "initrd");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("ramdisk_image=%s", val));
- val = ot_config_parser_get (config, "options");
+ val = ostree_bootconfig_parser_get (config, "options");
if (val)
g_ptr_array_add (new_lines, g_strdup_printf ("bootargs=%s", val));
+++ /dev/null
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2013 Colin Walters <walters@verbum.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2 of the licence or (at
- * your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include "ot-config-parser.h"
-#include "libgsystem.h"
-
-struct _OtConfigParser
-{
- GObject parent_instance;
-
- gboolean parsed;
- char *separators;
-
- GHashTable *options;
- GPtrArray *lines;
-};
-
-typedef GObjectClass OtConfigParserClass;
-
-G_DEFINE_TYPE (OtConfigParser, ot_config_parser, G_TYPE_OBJECT)
-
-gboolean
-ot_config_parser_parse (OtConfigParser *self,
- GFile *path,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean ret = FALSE;
- gs_free char *contents = NULL;
- char **lines = NULL;
- char **iter = NULL;
-
- g_return_val_if_fail (!self->parsed, FALSE);
-
- contents = gs_file_load_contents_utf8 (path, cancellable, error);
- if (!contents)
- goto out;
-
- lines = g_strsplit (contents, "\n", -1);
- for (iter = lines; *iter; iter++)
- {
- const char *line = *iter;
- char *keyname = "";
-
- if (g_ascii_isalpha (*line))
- {
- char **items = NULL;
- items = g_strsplit_set (line, self->separators, 2);
- if (g_strv_length (items) == 2 && items[0][0] != '\0')
- {
- keyname = items[0];
- g_hash_table_insert (self->options, items[0], items[1]);
- g_free (items); /* Transfer ownership */
- }
- else
- {
- g_strfreev (items);
- }
- }
- g_ptr_array_add (self->lines, g_variant_new ("(ss)", keyname, line));
- }
-
- self->parsed = TRUE;
-
- ret = TRUE;
- out:
- g_strfreev (lines);
- return ret;
-}
-
-void
-ot_config_parser_set (OtConfigParser *self,
- const char *key,
- const char *value)
-{
- g_hash_table_replace (self->options, g_strdup (key), g_strdup (value));
-}
-
-const char *
-ot_config_parser_get (OtConfigParser *self,
- const char *key)
-{
- return g_hash_table_lookup (self->options, key);
-}
-
-static gboolean
-write_key (OtConfigParser *self,
- GDataOutputStream *out,
- const char *key,
- const char *value,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean ret = FALSE;
-
- if (!g_data_output_stream_put_string (out, key, cancellable, error))
- goto out;
- if (!g_data_output_stream_put_byte (out, self->separators[0], cancellable, error))
- goto out;
- if (!g_data_output_stream_put_string (out, value, cancellable, error))
- goto out;
- if (!g_data_output_stream_put_byte (out, '\n', cancellable, error))
- goto out;
-
- ret = TRUE;
- out:
- return ret;
-}
-
-gboolean
-ot_config_parser_write (OtConfigParser *self,
- GFile *output,
- GCancellable *cancellable,
- GError **error)
-{
- gboolean ret = FALSE;
- GHashTableIter hashiter;
- gpointer hashkey, hashvalue;
- gs_unref_object GOutputStream *out = NULL;
- gs_unref_object GDataOutputStream *dataout = NULL;
- guint i;
- gs_unref_hashtable GHashTable *written_overrides = NULL;
-
- written_overrides = g_hash_table_new (g_str_hash, g_str_equal);
-
- out = (GOutputStream*)g_file_replace (output, NULL, FALSE, 0, cancellable, error);
- if (!out)
- goto out;
-
- dataout = g_data_output_stream_new (out);
-
- for (i = 0; i < self->lines->len; i++)
- {
- GVariant *linedata = self->lines->pdata[i];
- const char *key;
- const char *value;
- const char *line;
-
- g_variant_get (linedata, "(&s&s)", &key, &line);
-
- value = g_hash_table_lookup (self->options, key);
- if (value == NULL)
- {
- if (!g_data_output_stream_put_string (dataout, line, cancellable, error))
- goto out;
- if (!g_data_output_stream_put_byte (dataout, '\n', cancellable, error))
- goto out;
- }
- else
- {
- if (!write_key (self, dataout, key, value, cancellable, error))
- goto out;
- g_hash_table_insert (written_overrides, (gpointer)key, (gpointer)key);
- }
- }
-
- g_hash_table_iter_init (&hashiter, self->options);
- while (g_hash_table_iter_next (&hashiter, &hashkey, &hashvalue))
- {
- if (g_hash_table_lookup (written_overrides, hashkey))
- continue;
- if (!write_key (self, dataout, hashkey, hashvalue, cancellable, error))
- goto out;
- }
-
- if (!g_output_stream_close ((GOutputStream*)dataout, cancellable, error))
- goto out;
-
- ret = TRUE;
- out:
- return ret;
-}
-
-static void
-ot_config_parser_finalize (GObject *object)
-{
- OtConfigParser *self = OT_CONFIG_PARSER (object);
-
- g_hash_table_unref (self->options);
- g_ptr_array_unref (self->lines);
- g_free (self->separators);
-
- G_OBJECT_CLASS (ot_config_parser_parent_class)->finalize (object);
-}
-
-static void
-ot_config_parser_init (OtConfigParser *self)
-{
- self->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
- self->lines = g_ptr_array_new ();
-}
-
-void
-ot_config_parser_class_init (OtConfigParserClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- object_class->finalize = ot_config_parser_finalize;
-}
-
-OtConfigParser *
-ot_config_parser_new (const char *separators)
-{
- OtConfigParser *self = NULL;
-
- g_return_val_if_fail (separators != NULL && separators[0], NULL);
-
- self = g_object_new (OT_TYPE_CONFIG_PARSER, NULL);
- self->separators = g_strdup (separators);
- return self;
-}
+++ /dev/null
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2013 Colin Walters <walters@verbum.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2 of the licence or (at
- * your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#pragma once
-
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-#define OT_TYPE_CONFIG_PARSER (ot_config_parser_get_type ())
-#define OT_CONFIG_PARSER(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OT_TYPE_CONFIG_PARSER, OtConfigParser))
-#define OT_IS_CONFIG_PARSER(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OT_TYPE_CONFIG_PARSER))
-
-typedef struct _OtConfigParser OtConfigParser;
-
-GType ot_config_parser_get_type (void) G_GNUC_CONST;
-
-OtConfigParser * ot_config_parser_new (const char *separator);
-
-gboolean ot_config_parser_parse (OtConfigParser *self,
- GFile *path,
- GCancellable *cancellable,
- GError **error);
-
-gboolean ot_config_parser_write (OtConfigParser *self,
- GFile *output,
- GCancellable *cancellable,
- GError **error);
-
-void ot_config_parser_set (OtConfigParser *self,
- const char *key,
- const char *value);
-
-const char *ot_config_parser_get (OtConfigParser *self,
- const char *key);
-
-
-G_END_DECLS
-
+++ /dev/null
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2013 Colin Walters <walters@verbum.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2 of the licence or (at
- * your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include "ot-deployment.h"
-#include "libgsystem.h"
-
-struct _OtDeployment
-{
- GObject parent_instance;
-
- int index; /* Global offset */
- char *osname; /* osname */
- char *csum; /* OSTree checksum of tree */
- int deployserial; /* How many times this particular csum appears in deployment list */
- char *bootcsum; /* Checksum of kernel+initramfs */
- int bootserial; /* An integer assigned to this tree per its ${bootcsum} */
- OtConfigParser *bootconfig; /* Bootloader configuration */
- GKeyFile *origin; /* How to construct an upgraded version of this tree */
-};
-
-typedef GObjectClass OtDeploymentClass;
-
-G_DEFINE_TYPE (OtDeployment, ot_deployment, G_TYPE_OBJECT)
-
-const char *
-ot_deployment_get_csum (OtDeployment *self)
-{
- return self->csum;
-}
-
-const char *
-ot_deployment_get_bootcsum (OtDeployment *self)
-{
- return self->bootcsum;
-}
-
-const char *
-ot_deployment_get_osname (OtDeployment *self)
-{
- return self->osname;
-}
-
-int
-ot_deployment_get_deployserial (OtDeployment *self)
-{
- return self->deployserial;
-}
-
-int
-ot_deployment_get_bootserial (OtDeployment *self)
-{
- return self->bootserial;
-}
-
-OtConfigParser *
-ot_deployment_get_bootconfig (OtDeployment *self)
-{
- return self->bootconfig;
-}
-
-GKeyFile *
-ot_deployment_get_origin (OtDeployment *self)
-{
- return self->origin;
-}
-
-int
-ot_deployment_get_index (OtDeployment *self)
-{
- return self->index;
-}
-
-void
-ot_deployment_set_index (OtDeployment *self, int index)
-{
- self->index = index;
-}
-
-void
-ot_deployment_set_bootserial (OtDeployment *self, int index)
-{
- self->bootserial = index;
-}
-
-void
-ot_deployment_set_bootconfig (OtDeployment *self, OtConfigParser *bootconfig)
-{
- g_clear_object (&self->bootconfig);
- if (bootconfig)
- self->bootconfig = g_object_ref (bootconfig);
-}
-
-void
-ot_deployment_set_origin (OtDeployment *self, GKeyFile *origin)
-{
- g_clear_pointer (&self->origin, g_key_file_unref);
- if (origin)
- self->origin = g_key_file_ref (origin);
-}
-
-OtDeployment *
-ot_deployment_clone (OtDeployment *self)
-{
- OtDeployment *ret = ot_deployment_new (self->index, self->osname, self->csum,
- self->deployserial,
- self->bootcsum, self->bootserial);
- ot_deployment_set_bootconfig (ret, self->bootconfig);
- ot_deployment_set_origin (ret, self->origin);
- return ret;
-}
-
-guint
-ot_deployment_hash (gconstpointer v)
-{
- OtDeployment *d = (OtDeployment*)v;
- return g_str_hash (ot_deployment_get_osname (d)) +
- g_str_hash (ot_deployment_get_csum (d)) +
- ot_deployment_get_deployserial (d);
-}
-
-gboolean
-ot_deployment_equal (gconstpointer ap, gconstpointer bp)
-{
- OtDeployment *a = (OtDeployment*)ap;
- OtDeployment *b = (OtDeployment*)bp;
-
- if (a == NULL && b == NULL)
- return TRUE;
- else if (a != NULL && b != NULL)
- return g_str_equal (ot_deployment_get_osname (a),
- ot_deployment_get_osname (b)) &&
- g_str_equal (ot_deployment_get_csum (a),
- ot_deployment_get_csum (b)) &&
- ot_deployment_get_deployserial (a) == ot_deployment_get_deployserial (b);
- else
- return FALSE;
-}
-
-static void
-ot_deployment_finalize (GObject *object)
-{
- OtDeployment *self = OT_DEPLOYMENT (object);
-
- g_free (self->osname);
- g_free (self->csum);
- g_free (self->bootcsum);
- g_clear_object (&self->bootconfig);
- g_clear_pointer (&self->origin, g_key_file_unref);
-
- G_OBJECT_CLASS (ot_deployment_parent_class)->finalize (object);
-}
-
-void
-ot_deployment_init (OtDeployment *self)
-{
-}
-
-void
-ot_deployment_class_init (OtDeploymentClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
-
- object_class->finalize = ot_deployment_finalize;
-}
-
-OtDeployment *
-ot_deployment_new (int index,
- const char *osname,
- const char *csum,
- int deployserial,
- const char *bootcsum,
- int bootserial)
-{
- OtDeployment *self;
-
- /* index may be -1 */
- g_return_val_if_fail (osname != NULL, NULL);
- g_return_val_if_fail (csum != NULL, NULL);
- g_return_val_if_fail (deployserial >= 0, NULL);
- /* We can have "disconnected" deployments that don't have a
- bootcsum/serial */
-
- self = g_object_new (OT_TYPE_DEPLOYMENT, NULL);
- self->index = index;
- self->osname = g_strdup (osname);
- self->csum = g_strdup (csum);
- self->deployserial = deployserial;
- self->bootcsum = g_strdup (bootcsum);
- self->bootserial = bootserial;
- return self;
-}
+++ /dev/null
-/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*-
- *
- * Copyright (C) 2013 Colin Walters <walters@verbum.org>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published
- * by the Free Software Foundation; either version 2 of the licence or (at
- * your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#pragma once
-
-#include <gio/gio.h>
-#include "ot-config-parser.h"
-
-G_BEGIN_DECLS
-
-#define OT_TYPE_DEPLOYMENT (ot_deployment_get_type ())
-#define OT_DEPLOYMENT(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), OT_TYPE_DEPLOYMENT, OtDeployment))
-#define OT_IS_DEPLOYMENT(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), OT_TYPE_DEPLOYMENT))
-
-typedef struct _OtDeployment OtDeployment;
-
-GType ot_deployment_get_type (void) G_GNUC_CONST;
-
-guint ot_deployment_hash (gconstpointer v);
-gboolean ot_deployment_equal (gconstpointer a, gconstpointer b);
-
-OtDeployment * ot_deployment_new (int index,
- const char *osname,
- const char *csum,
- int deployserial,
- const char *bootcsum,
- int bootserial);
-
-int ot_deployment_get_index (OtDeployment *self);
-const char *ot_deployment_get_osname (OtDeployment *self);
-int ot_deployment_get_deployserial (OtDeployment *self);
-const char *ot_deployment_get_csum (OtDeployment *self);
-const char *ot_deployment_get_bootcsum (OtDeployment *self);
-int ot_deployment_get_bootserial (OtDeployment *self);
-OtConfigParser *ot_deployment_get_bootconfig (OtDeployment *self);
-GKeyFile *ot_deployment_get_origin (OtDeployment *self);
-
-void ot_deployment_set_index (OtDeployment *self, int index);
-void ot_deployment_set_bootserial (OtDeployment *self, int index);
-void ot_deployment_set_bootconfig (OtDeployment *self, OtConfigParser *bootconfig);
-void ot_deployment_set_origin (OtDeployment *self, GKeyFile *origin);
-
-OtDeployment *ot_deployment_clone (OtDeployment *self);
-
-
-G_END_DECLS
-